<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> 
  <head>
    <base href="<%=basePath%>" />
    <title>Abnormal Data of Heat Meter Task</title>
    <script type="text/javascript">
		var path = "<%=basePath%>";
	</script>
	<meta http-equiv="pragma" content="no-cache" />
	<meta http-equiv="cache-control" content="no-cache" />
	<meta http-equiv="expires" content="0" />    
	<link rel="stylesheet" type="text/css" href="<%=basePath%>beshs/css/content.css" />
	<link rel="stylesheet" type="text/css" href="<%=basePath%>resources/select2/css/select2.min.css" />
	<script type="text/javascript" src="<%=basePath%>resources/jquery/jquery-1.7.2.min.js"></script>
	<script type="text/javascript" src="<%=basePath%>resources/datepicker/datepicker.js"></script>
	<!-- 页面特效 -->
	<jsp:include page="/beshs/res-refer/page-effect-reference.jsp" />
	<!-- 系统通用资源 -->
	<jsp:include page="/resources/resource-refer/common-resource-reference.jsp" />
	<!-- 用户访问菜单路径 -->
	<jsp:include page="/resources/usertrace/common-uservisit-reference.jsp" />
	<!-- 表单校验 -->
	<jsp:include page="/resources/resource-refer/component-validform-reference.jsp" />
	<script type="text/javascript" src="<%=basePath%>resources/select2/js/select2.min.js"></script>
  <script type="text/javascript">
  	$(function(){
		$("form[name='query']").Validform({
			btnSubmit: "input[name='submit']",
			btnReset: "input[name='reset']",
			tiptype: function(msg, o, cssctl){
				//msg：提示信息;
				//o:{obj:*,type:*,curform:*}, obj指向的是当前验证的表单元素（或表单对象），type指示提示的状态，值为1、2、3、4， 1：正在检测/提交数据，2：通过验证，3：验证失败，4：提示ignore状态, curform为当前form对象;
				//cssctl:内置的提示信息样式控制函数，该函数需传入两个参数：显示提示信息的对象 和 当前提示的状态（既形参o中的type）;
				if(!o.obj.is("form")){//验证表单元素时o.obj为该表单元素，全部验证通过提交表单时o.obj为该表单对象;
					var objtip=o.obj.siblings(".Validform_checktip");
					cssctl(objtip,o.type);
					objtip.text(msg);
				} else {
					var objtip=o.obj.find("#msgdemo");
					cssctl(objtip,o.type);
					objtip.text(msg);
				}
			},
			postonce: true, //开启二次提交防御，在数据成功提交后，表单将不能再继续提交
			showAllError: true, //提交表单时所有错误提示信息都会显示
			beforeSubmit: function(curform) { //在验证成功后，表单提交前执行的函数，curform参数是当前表单对象
// 				curform.submit();
				return true; //这里明确return false的话表单将不会提交
			}
		});
  	});
  </script>
 </head>
  <body>
    <div class="content_all">
  		<!--导航条-->
  		<div class="insertinfo_table">
      		<form action="<%=basePath%>dataException/heatMeterDataExceptionQueryAction!addQuery.do" name="query"
      			enctype="multipart/form-data" method="post" target="async_frame_submit">
      		  <iframe name="async_frame_submit" id="async_frame_submit" style="display: none;"></iframe>
      		  <table width="100%" border="0" cellspacing="0" cellpadding="0">
        		<tr>
          			<th>Project：</th>
          			<td>
          				<s:select name="projectID" list="projectList" listKey="id" listValue="projectName" headerKey="" headerValue="Please select" cssClass="s_sel"
          					datatype="*" nullmsg="Please select the project！" errormsg="Please select the project！"></s:select>
            			&nbsp;<span style="color:#FF0000;">*</span>
            			<div class="Validform_checktip"></div></td>
            		<th>District：</th>
          			<td>
          				<script type="text/javascript">
          					function reloadCommunitys(projectUID, communityUID) {
          						$("select[name='communityID']").children("option").slice(1).remove();
          						if(projectUID!=null && projectUID!="") {
		        					$.getJSON(path+"beshs/communityActionJson!queryCommunitysByBelongs.do?date="+new Date(), {
		        						projectUID: projectUID
		        					}, function(data) {
		        						for(var index=0; index<data.length; index++) {
		        							if(communityUID!=null && communityUID!="" && communityUID==data[index].id) {
		        								$("select[name='communityID']").append("<option value='"+data[index].id+"' selected='selected'>"+data[index].communityName+"</option>");
		        							} else {
		        								$("select[name='communityID']").append("<option value='"+data[index].id+"'>"+data[index].communityName+"</option>");
		        							}
		        						}
		        					});
		        				} 
          					}	
          				
	          				$("select[name='projectID']").change(function(){
								var projectUID = $(this).val();
	  							var communityUID = $("select[name='communityID']").val();
	  							reloadCommunitys(projectUID, communityUID);
	  						});
          				</script>
          				<s:select name="communityID" list="communityList" listKey="id" listValue="communityName" headerKey="" headerValue="Please select" cssClass="s_sel"
          					datatype="*" nullmsg="Please select the district！" errormsg="Please select the district！"></s:select>
          				&nbsp;<span style="color:#FF0000;">*</span>
          				<div class="Validform_checktip"></div></td>
        		</tr>
        		<tr>
        			<th>Building：</th>
          			<td>
          			     <script type="text/javascript">
	          				function reloadBuildings(projectUID, communityUID, buildingUID) {
	          					$("select[name='buildingID']").children("option").slice(1).remove();
          						if((projectUID!=null && projectUID!="") 
          								|| (communityUID!=null && communityUID!="")) {
          							$.getJSON(path+"beshs/buildingActionJson!queryBuildingsByBelongs.do?date="+new Date(), {
          								projectUID: projectUID,
          								communityUID: communityUID
		        					}, function(data) {
		        						for(var index=0; index<data.length; index++) {
		        							if(buildingUID!=null && buildingUID!="" && buildingUID==data[index].id) {
		        								$("select[name='buildingID']").append("<option value='"+data[index].id+"' selected='selected'>"+data[index].buildingName+"</option>");
		        							} else {
		        								$("select[name='buildingID']").append("<option value='"+data[index].id+"'>"+data[index].buildingName+"</option>");
		        							}
		        						}
		        					});
          						}
	          				}
          				
	          				$(function(){
	      						$("select[name='projectID']").change(function(){
	      							var projectUID = $(this).val();
	      							var communityUID = $("select[name='communityID']").val();
	      							var buildingUID = $("select[name='buildingID']").val();
	      							reloadBuildings(projectUID, communityUID, buildingUID);
	      						});
	      						
								$("select[name='communityID']").change(function(){
									var communityUID = $(this).val();
	      							var projectUID = $("select[name='projectID']").val();
	      							var buildingUID = $("select[name='buildingID']").val();
	      							reloadBuildings(projectUID, communityUID, buildingUID);
	      						});
	      					});
          				</script>
          				<s:select name="buildingID" list="buildingList" listKey="id" listValue="buildingName" headerKey="" headerValue="Please select" cssClass="s_sel"></s:select>
            			&nbsp;</td>
<!--             		<th>热量表号:</th> -->
<!--         			<td><input type="text" name="meterNo"/></td> -->
        		</tr>
        		<tr>
					<th>Abnormal Upload:</th>
        			<td><input type="checkbox" name="unUpload" value="true" checked="checked"/></td>
					<th>Abnormal Data:</th>
        			<td><input type="checkbox" name="dataException" value="true" checked="checked"/></td>
        		</tr>
   
				<tr>
					<th>Accumulated Heat:</th>
					<td>
					<select name="sumHeatCom">
					<option value="b">&gt;</option>
					<option value="s">&lt;</option>
					</select>
					<input type="text" class="s_input" name="sumHeat" datatype="n1-10|/^([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$/" ignore="ignore" errormsg="Please enter integral or float type value！"/>
					<select name="sumHeatUnit">
					<option value="1">MWh</option>
					<option value="2">kWh</option>
					<option value="3">Gj</option>
					</select>
					</td>
					<th>Instantaneous Flow:</th>
					<td>
					<select name="instantFlowCom">
					<option value="b">&gt;</option>
					<option value="s">&lt;</option>
					</select>
					<input type="text" class="s_input" name="instantFlow" datatype="n1-10|/^([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$/" ignore="ignore" errormsg="Please enter integral or float type value！"/>
					<select name="instantFlowUnit">
					<option value="1">m3/h</option>
					<option value="2">dm3/h</option>
					<option value="3">cm3/h</option>
					</select>
					</td>
				</tr>
				<tr>
					<th>Temperature of Supply Water:</th>
					<td>
					<select name="supplyTemperatureCom">
					<option value="b">&gt;</option>
					<option value="s">&lt;</option>
					</select>
					<input type="text" class="s_input" name="supplyTemperature" datatype="n1-10|/^([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$/" ignore="ignore" errormsg="Please enter integral or float type value！"/>℃
					</td>
					<th>Temperature of Return Water:</th>
					<td>
					<select name="backTemperatureCom">
					<option value="b">&gt;</option>
					<option value="s">&lt;</option>
					</select>
					<input type="text" class="s_input" name="backTemperature" datatype="n1-10|/^([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$/" ignore="ignore" errormsg="Please enter integral or float type value！"/>℃
					</td>
				</tr>
				<tr>
					<th>Temperature Difference:</th>
					<td>
					<select name="temperatureDiffCom">
					<option value="b">&gt;</option>
					<option value="s">&lt;</option>
					</select>
					<input type="text" class="s_input" name="temperatureDiff" datatype="n1-10|/^([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$/" ignore="ignore" errormsg="Please enter integral or float type value！"/>℃
					</td>
        		</tr>
        		<tr>
					<th>Query Start Date:</th>
					<td>
					<input id="startRecordTime" name="startRecordTime" class="Wdate" nullmsg="Please enter query start date！" errormsg="Please enter date and time in correct format such as-- 2014-07-19！" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true})" />
					
<!-- 					<input name="startRecordTime" id="startRecordTime" type="text" class="s_input" onclick="selectDate(this,'yyyy-MM-dd')"  -->
<!--           					datatype="/^(\d{4})-(\d{1,2})-(\d{1,2})$/" nullmsg="Please enter query start date！" errormsg="Please enter date and time in correct format such as-- 2014-07-19！" readonly/> -->
<%--           				<img src="<%=basePath%>resources/datepicker/calendar.jpg" onclick="txtSelectDate('startRecordTime','yyyy-MM-dd')"/> --%>
          				<div class="Validform_checktip"></div>
					</td>
					<th>Query End Date:</th>
					<td>
					<input id="endRecordTime" name="endRecordTime" class="Wdate" nullmsg="Please enter query end date！" errormsg="Please enter date and time in correct format such as-- 2014-07-19！" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true})" />
					
<!-- 					<input name="endRecordTime" id="endRecordTime" type="text" class="s_input"  onclick="selectDate(this,'yyyy-MM-dd')"  -->
<!--           					datatype="/^(\d{4})-(\d{1,2})-(\d{1,2})$/" nullmsg="Please enter query end date！" errormsg="Please enter date and time in correct format such as-- 2014-07-19！" readonly/> -->
<%--           				<img src="<%=basePath%>resources/datepicker/calendar.jpg" onclick="txtSelectDate('endRecordTime','yyyy-MM-dd')"/> --%>
          				<div class="Validform_checktip"></div>
					</td>
        		</tr>
        		
        		<tr>
          			<td style="border:none;" colspan="4" align="center">
          				<input name="submit" type="submit" value="Submit" class="s_btn" />
            			<input name="reset" type="reset" value="Reset" class="s_btn"/></td>
        		</tr>
      		</table></form>
  		</div>
	</div>
	<script type="text/javascript">
		/**
  	 * 热量表信息提交回调
  	 * @param {Object} data
  	 */
  	function uploadCallBack(data) {
  		var resJson = $.parseJSON(data);
  		if(resJson.success) {
  			Dialog.alert("Successful Operation！", function() {
  				var pwin = window.dialogArguments;
  		  		pwin.parent.window.frames["c_content_content"].location = path+"dataException/heatMeterDataExceptionQueryAction!queryList.do?date="+new Date();
  	  			window.close();
  			});
  		} else {
  			Dialog.alert(resJson.msg);
  		}
  	}
	</script>
	<div class="clear"></div>
  </body>
</html>
